home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 27 / CU Amiga Magazine's Super CD-ROM 27 (1998)(EMAP Images)(GB)[!][issue 1998-10].iso / CUCD / Programming / Mesa / src-glut / glutExtensionSupported.c < prev    next >
C/C++ Source or Header  |  1998-08-02  |  1KB  |  58 lines

  1.  
  2. /* Copyright (c) Mark J. Kilgard, 1994. */
  3.  
  4. /* This program is freely distributable without licensing fees
  5.    and is provided without guarantee or warrantee expressed or
  6.    implied. This program is -not- in the public domain. */
  7.  
  8. /*
  9.  * glutExtensionSupported.c
  10.  *
  11.  * Version 1.0  27 Jun 1998
  12.  * by Jarno van der Linden
  13.  * jarno@kcbbs.gen.nz
  14.  *
  15.  * Based on glut_ext.c to work with Amiga GLUT
  16.  *
  17.  */
  18.  
  19. #include <stdlib.h>
  20. #include <string.h>
  21.  
  22. #include "glutstuff.h"
  23.  
  24.  
  25. int glutExtensionSupported(const char *extension)
  26. {
  27.   static const GLubyte *extensions = NULL;
  28.   const GLubyte *start;
  29.   GLubyte *where, *terminator;
  30.  
  31.   /* Extension names should not have spaces. */
  32.   where = (GLubyte *) strchr(extension, ' ');
  33.   if (where || *extension == '\0')
  34.     return 0;
  35.  
  36.   if (!extensions)
  37.     extensions = glGetString(GL_EXTENSIONS);
  38.   /* It takes a bit of care to be fool-proof about parsing the
  39.      OpenGL extensions string.  Don't be fooled by sub-strings,
  40.      etc. */
  41.   start = extensions;
  42.   for (;;) {
  43.     where = (GLubyte *) strstr((const char *) start, extension);
  44.     if (!where)
  45.       break;
  46.     terminator = where + strlen(extension);
  47.     if (where == start || *(where - 1) == ' ') {
  48.       if (*terminator == ' ' || *terminator == '\0') {
  49.         return 1;
  50.       }
  51.     }
  52.     start = terminator;
  53.   }
  54.   return 0;
  55. }
  56.  
  57. /* ENDCENTRY */
  58.